package com.example.algorithm.sort.recursion;

/**
 * @program: algorithm
 * @description:
 * @packagename: com.example.algorithm.sort.recursion
 * @author: Jay
 * @date: 2022/03/26 18:29:03
 **/
public class TestFactorial {

    //求n的阶乘
    public static void main(String[] args) {
        long factorial = factorial(9);
        System.out.println(factorial);
    }

    //求n的阶乘
    public static long factorial(int n){
        if (n == 1){
            return 1;
        }
        return n*factorial(n-1);
    }
}
